﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using SIMCFachadaNegocio;
using SIMCObjetoNegocio;


/// <summary>
/// Summary description for MembershipUsuario
/// </summary>
public class MembershipUsuario : MembershipUser
{
    /// <summary>
    /// 1 Usuario Interno; 2 Usuario Externo 
    /// </summary>
    public TipoUsuario TipoUsuario { get; set; } 
    public string NombreCompleto { get; set; } // Usado para mensajes internos al usuario
    public Rol rol { get; set; }
    public List<Permiso> Permisos { get; set; }
    public string Telefono { get; set; }
    public DateTime TempPasswordDate { get; set; }
    public string Nombre { get; set; }
    public string Apellido { get; set; }
    public int UserId { get; set; }

    public MembershipUsuario()
    {
        rol = new Rol();
    }

    public MembershipUsuario(string providerName, string name, object providerUserKey, string email, string passwordQuestion, string comment, bool isApproved, bool isLockedOut, DateTime creationDate, DateTime lastLoginDate, DateTime lastActivityDate, DateTime lastPasswordChangedDate, DateTime lastLockoutDate)
        : base(providerName, name, providerUserKey, email, passwordQuestion, comment, isApproved, isLockedOut, creationDate, lastLoginDate, lastActivityDate, lastPasswordChangedDate, lastLockoutDate)
    {
        //
        // TODO: Add constructor logic here
        //

    }

    public override string Email
    {
        get
        {
            if (base.Email == "<N/A>")
                return "No posee correo";
            return base.Email;
        }
        set
        {
            base.Email = value;
        }
    }

    public string TipoUsuarioDescripcion
    {
        get
        {
            //if (this.TipoUsuario == 1)
            //{
            //    return "INTERNO";
            //}
            //else
            //{
            //    return "EXTERNO";
            //}
            return this.TipoUsuario.ToString();
        }
    }

    public bool TieneClaveTemporal 
    {
        get { return (this.TempPasswordDate != DateTime.MinValue); }
    }

}